unit uVideo;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls,chatwin,protocol, Menus,global, BusinessSkinForm;

type
  TfrmVideo = class(TForm)
    bsBusinessSkinForm1: TbsBusinessSkinForm;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    ChatingForm:TfrmChating;
    VideoHandShake:TVideoHandShake;
  end;

var
  frmVideo: TfrmVideo;

implementation
uses uDmodule;

{$R *.dfm}

procedure TfrmVideo.FormCreate(Sender: TObject);
begin
  DoubleBuffered:=True;
end;

procedure TfrmVideo.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  if PEmployee(ChatingForm.TVUserList.Items.GetFirstNode.Data).HaveVideoDevice then
  begin
    if (ChatingForm.Width-ChatingForm.PnlLeftTop.Width<ChatingForm.PnlYourCamera.Width) then ChatingForm.PnlLeftTop.Width:=ChatingForm.PnlLeftTop.Width - ChatingForm.PnlYourCamera.Width - 2;
    ChatingForm.PnlYourCamera.Show;
  end;
  Action:=caFree;
  if VideoHandShake<>nil then VideoHandShake.PDC:=GetDC(ChatingForm.AviPanelOut.Handle);
  SetStretchBltMode(VideoHandShake.PDC,HALFTONE);
  frmVideo:=nil;
end;

procedure TfrmVideo.FormShow(Sender: TObject);
begin
  if PEmployee(ChatingForm.TVUserList.Items.GetFirstNode.Data).HaveVideoDevice then
  begin
    if (ChatingForm.Width-ChatingForm.PnlLeftTop.Width>ChatingForm.PnlYourCamera.Width) then ChatingForm.PnlLeftTop.Width:=ChatingForm.PnlLeftTop.Width + ChatingForm.PnlYourCamera.Width + 2;
    ChatingForm.PnlYourCamera.Hide;
  end;
end;

end.
